package com.shujia.dwd

import com.shujia.commom.SparkTool
import org.apache.spark.sql.{DataFrame, SparkSession}

object DwdRsZhcsAz01bsbkxxMskDay extends SparkTool {
  /**
   * 抽象方法: 在子类中实现这个方法
   * import spark.implicits._
   * import org.apache.spark.sql.functions._
   *
   * @param spark ：spark环境
   * @param ds    ：分区
   */
  override def run(spark: SparkSession, ds: String): Unit = {
    import spark.implicits._
    import org.apache.spark.sql.functions._


    val az01bsbkxx: DataFrame = spark
      .table("ods.ods_t_rs_zhcs_az01bsbkxx")
      .where($"ds" === ds)


    val resultDF: DataFrame = az01bsbkxx
      .select(
        upper(md5($"id")) as "id",
        $"citty_id",
        $"ss_id",
        $"fkrq",
        $"yxqz",
        $"aaz502",
        $"aae008",
        $"aae008b",
        $"aae010",
        $"aae010a",
        $"aae010b"
      )

    save(resultDF, s"/daas/motl/dwd/dwd_rs_zhcs_az01bsbkxx_msk_d/ds=$ds")
  }
}
